import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutterapp/page/utils/scopoed_model_helper.dart';
import 'package:flutterapp/scoped_model/auth.dart';

class Loading extends StatefulWidget {
  const Loading({Key key}) : super(key: key);

  @override
  _LoadingState createState() => _LoadingState();
}

class _LoadingState extends State<Loading> {
  @override
  void initState() {
    //延迟跳转
    Future.delayed(Duration(milliseconds: 3000), () {
      Navigator.of(context).pushReplacementNamed('/');
    });
    Timer.run(() {
      ScopedModelHelper.getModel<AuthModel>(context).initApp(context);
    });
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        image: new DecorationImage(
          image: NetworkImage("http://r0utoyzux.hn-bkt.clouddn.com/15151.jpg"),
          fit: BoxFit.fill,
        ),
      ),
    );
  }
}
